<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html; charset=UTF-8"%> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setCharacterEncoding("UTF-8");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'emp_add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/emp_add.css">

</head>
<body>
	<h3>修改部门</h3>
	<c:choose>
		<c:when test="${param.update!=null}">
			<sql:update var="result1">
				update t_department set dept_name=?,dept_depict=?,dept_director=? where dept_id=?
			    <sql:param value="${param.dept_name}" />
				<sql:param value="${param.dept_depict}" />
				<sql:param value="${param.dept_director}" />
				<sql:param value="${param.dept_id}" />
			</sql:update>
			<h1>部门信息修改成功</h1>
		</c:when>
		<c:otherwise>
			<sql:query var="result"
				sql="select  dept_id,dept_name,dept_depict,dept_director from t_department where dept_id=?">
				<sql:param value="${param.dept_id}" />
			</sql:query>
			<div id="container">
				<form id="fm-form" method="post" action="admin/dept_update.jsp">
					<c:forEach var="row" items="${result.rows}">
						<fieldset>
							<div class="fm-opt">
								<label for="fm-addr">部门名称</label> <input id="fm-addr"
									name="dept_name" value='${row.dept_name}' type="text">
								<input id="fm-addr" type="hidden" name="dept_id"
									value="${row.dept_id}" type="text">
							</div>
							<div class="fm-opt">
								<label for="fm-addr">部门描述</label> <input id="fm-addr"
									value="${row.dept_depict}" name="dept_depict" type="text">
							</div>
							<div class="fm-opt">
								<label for="fm-addr">负责人</label> <input id="fm-addr"
									value="${row.dept_director}" name="dept_director" type="text">
							</div>
							<input type="hidden" value="update" name="update" type="text">

						</fieldset>
					</c:forEach>
					<div id="fm-submit" class="fm-req">
						<input name="Submit" value="&#25552; &#20132;" type="submit">
					</div>
					<br>
				</form>
			</div>

		</c:otherwise>
	</c:choose>

	<%--<div class="fm-opt">
					<label for="fm-addr">部门名称</label> <input id="fm-addr"
						name="department.dept_name"  value='<s:property value="department.dept_name" />' type="text">
					 <input id="fm-addr" type="hidden"
						name="department.dept_id"  value='<s:property value="department.dept_id" />' type="text">
				</div>
				--%>
</body>
</html>
